package com.bitcola.security.admin.rest;

import com.bitcola.security.admin.biz.ColaLabsProjectBiz;
import com.bitcola.security.admin.entity.ApplyProject;
import com.bitcola.security.common.msg.AppResponse;
import com.bitcola.security.common.msg.TableResultResponse;
import com.bitcola.security.common.util.AdminQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @date 2019/11/14 13:23
 */
@RestController
@RequestMapping("/labs")
public class ColaLabsProjectController {

    @Autowired
    private ColaLabsProjectBiz colaLabsProjectBiz;

    @GetMapping("/projectList")
    public TableResultResponse projectList(@RequestParam Map<String, Object> params) {
        AdminQuery query = new AdminQuery(params);
//        查询列表
        return colaLabsProjectBiz.projectList(query);
    }

    @PostMapping("/project")
    public AppResponse addProject(@RequestBody ApplyProject applyProject) {
//        新增
        return colaLabsProjectBiz.addProject(applyProject);
    }

    @PutMapping("/project/{id}")
    public AppResponse updateProject(@PathVariable("id") String id, @RequestBody ApplyProject applyProject) {
//        修改
        return colaLabsProjectBiz.updateProject(id, applyProject);
    }

}
